# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=dust
pkgver=1.1.1
pkgrel=0
pkgdesc="A more intuitive version of du in Rust"
url="https://github.com/bootandy/dust"
# riscv64: rust broken
arch="all !riscv64"
license="Apache-2.0"
makedepends="cargo cargo-auditable"
options="net"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/bootandy/dust/archive/v$pkgver/dust-$pkgver.tar.gz"

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
	# this test runs dust and expects the output to match 100%,
	# which fails a lot of the time on various systems as you can't guarantee that
	rm tests/test_exact_output.rs
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/
	install -D -m644 completions/dust.bash "$pkgdir"/usr/share/bash-completion/completions/dust
	install -D -m644 completions/dust.fish "$pkgdir"/usr/share/fish/vendor_completions.d/dust.fish
	install -D -m644 completions/_dust "$pkgdir"/usr/share/zsh/site-functions/_dust
	install -D -m644 man-page/dust.1 "$pkgdir"/usr/share/man/man1/dust.1
}

sha512sums="
c7051fa5a924891aa25fac22d3e5c53dd5a6c5ae063e6013316c78f7ac1c0006f8523781ccefe5b9a9cc0b2a799decb0d045bb7a37db78e9e97b805f8c085f33  dust-1.1.1.tar.gz
"
